import { IToolTipItem } from "../../../../../com/mui/manager/IToolTipItem";
import { SWFPlayer } from "../../../scene/modle/SWFPlayer";
import { ModelType } from "../../../scene/modle/data/ModelType";
import { ActionType } from "../../../scene/modle/data/ActionType";
import { GModuleEvent } from "../../../mvc/GModuleEvent";
import { LookupPlayerData } from "../LookupPlayerData";
import { AcupointData } from "./AcupointData";
import { AcupointConfig } from "../../../resource/AcupointConfig";
import { FilterConst } from "../../../../component/gconst/FilterConst";
import { LoaderHelp } from "../../../../common/display/LoaderHelp";
import { ResFileConst } from "../../../resource/ResFileConst";
import { ColorConfig } from "../../../resource/ColorConfig";
import { Language } from "../../../../../extend/language/Language";
import { ToolTipInfo } from "../../../model/ToolTipInfo";
import { NormalTooltip } from "../../common/tooltip/NormalTooltip";
import { GlobalClass } from "../../../../../com/mui/core/GlobalClass";
import { ImagesConst } from "../../../resource/ImagesConst";
import { ToolTipsManager } from "../../../../../com/mui/manager/ToolTipsManager";
type int = number;
//class AcupointBourn
    
    export  class AcupointBourn /* flash.display.Sprite */ implements IToolTipItem
    {
        

        public set mode(arg1: string)
        {
            this._mode = arg1;
            return;
        }

        /* internal  */init(): void
        {
            if (!this._leftFire) 
            {
                this._leftFire = new SWFPlayer();
            }
            this._leftFire.loadComplete = this.loadLeftSWFComplete;
            this._leftFire.load("bournFire.swf", ModelType.NormalSwf, null);
            addChild(this._leftFire);
            if (!this._rightFire) 
            {
                this._rightFire = new SWFPlayer();
            }
            this._rightFire.loadComplete = this.loadRightSWFComplete;
            this._rightFire.load("bournFire.swf", ModelType.NormalSwf, null);
            addChild(this._rightFire);
            return;
        }

        /* internal  */loadLeftSWFComplete(arg1: SWFPlayer): void
        {
            this._leftFire.updateFrame(ActionType.Stand, 1, true);
            this._leftFire.updateCurrentFrame(0);
            this._leftFire.play();
            this._leftFire.move(10, 20);
            return;
        }

        /* internal  */loadRightSWFComplete(arg1: SWFPlayer): void
        {
            this._rightFire.updateFrame(ActionType.Stand, 1, true);
            this._rightFire.updateCurrentFrame(0);
            this._rightFire.play();
            this._rightFire.move(65, 20);
            return;
        }

        /* internal  */loadBournSWFComplete(arg1: SWFPlayer): void
        {
            this._bournSwf.updateFrame(ActionType.Stand, 1, true);
            this._bournSwf.updateCurrentFrame(0);
            this._bournSwf.play();
            return;
        }

        public updateInfo(arg1: int): void
        {
            var loc1=null;
            var loc8=0;
            if (this._mode != GModuleEvent.Mode_Self) 
            {
                loc1 = LookupPlayerData.acupointInfo;
            }
            else 
            {
                loc1 = AcupointData.acupointInfo;
            }
            var loc2=AcupointConfig.instance.getBournIndex(arg1);
            if (this._bitmap && this._bitmap.parent) 
            {
                removeChild(this._bitmap);
            }
            this.dispose();
            if (arg1 == 0) 
            {
                if (!this._bitmap) 
                {
                    this._bitmap = new Object /* flash.display.Bitmap */();
                }
                this._bitmap.x = 0;
                this._bitmap.y = 0;
                addChild(this._bitmap);
                this._bitmap.filters = [FilterConst.colorFilter];
                LoaderHelp.addResCallBack(ResFileConst.breakThrough, this.onResLoaded);
            }
            else 
            {
                if (this._bournSwf == null) 
                {
                    this._bournSwf = new SWFPlayer();
                }
                this._bournSwf.loadComplete = this.loadBournSWFComplete;
                this._bournSwf.load("BreakThrough_" + loc2 + ".swf", ModelType.NormalSwf, null);
                addChild(this._bournSwf);
                this._bournSwf.move(35, 15);
            }
            var loc3=AcupointConfig.instance.getBournInfoByLevel(arg1);
            var loc4=AcupointConfig.instance.getNextBournInfoByLevel(arg1);
            var loc5="";
            var loc6=[];
            var loc7=[];
            var loc9=ColorConfig.instance.getItemColorString(4);
            if (arg1 == 0) 
            {
                if (loc3 != null) 
                {
                    if (loc1.acupoint >= loc3.acupointLevel) 
                    {
                        loc8 = (loc1.step - 1);
                    }
                    else 
                    {
                        loc8 = 0;
                    }
                    loc5 = (loc5 = "") + "<font size=\'14\'><font color=\'" + loc9 + "\'>" + Language.getStringByParam(30111, loc3.acupointLevel) + "<font color=\'#00ff00\'>（<font color=\'#ff0000\'>" + loc8 + "</font>/8）</font></font>\n" + "<font color=\'#7c7c7c\'><textFormat leading=\'3\'>" + loc3.info + "</textFormat>\n\n</font>";
                    loc6.push(loc5);
                    loc7.push(loc2);
                }
            }
            else 
            {
                if (loc4 != null) 
                {
                    if (loc1.acupoint >= loc4.acupointLevel) 
                    {
                        loc8 = (loc1.step - 1);
                    }
                    else 
                    {
                        loc8 = 0;
                    }
                    loc5 = loc5 + "<font size=\'14\'><font color=\'" + loc9 + "\'>" + Language.getStringByParam(30111, loc4.acupointLevel) + "</font>" + "<font color=\'#00ff00\'>（<font color=\'#ff0000\'>" + loc8 + "</font>/8）</font></font>\n" + "<font color=\'#7c7c7c\'><textFormat leading=\'3\'>" + loc4.info + "</textFormat>\n\n</font>";
                    loc6.push(loc5);
                    loc7.push(loc2 + 1);
                }
                if (loc3 != null) 
                {
                    loc5 = (loc5 = "") + "<font size=\'14\'><font color=\'" + loc9 + "\'>" + Language.getStringByParam(30111, arg1) + "</font>" + "<font color=\'#00ff00\'>" + Language.getString(30112) + "</font></font>\n" + "<font color=\'#F1FFB1\'><textFormat leading=\'3\'>" + loc3.info + "</textFormat>\n\n</font>";
                    loc6.push(loc5);
                    loc7.push(loc2);
                }
            }
            loc5 = (loc5 = "") + "<font color=\'#ffffff\'>  " + Language.getString(30113) + "</font>";
            loc6.push(loc5);
            var loc10=[loc6, loc7];
            var loc11=new ToolTipInfo(NormalTooltip.ToolTipRenderType_Bourn, loc10);
            this.toolTipData = loc11;
            return;
        }

        /* internal  */onResLoaded(): void
        {
            this._bitmap.bitmapData = GlobalClass.getBitmapData(ImagesConst.BreakThrough);
            return;
        }

        public get toolTipData()
        {
            return this._toolTipData;
        }

        public set toolTipData(arg1)
        {
            if (arg1 == null || arg1 == "") 
            {
                ToolTipsManager.unregister(this);
            }
            else 
            {
                ToolTipsManager.register(this);
            }
            this._toolTipData = arg1;
            return;
        }

        public dispose(): void
        {
            if (this._bournSwf) 
            {
                this._bournSwf.stop();
                this._bournSwf.dispose();
            }
            return;
        }

        /* internal */ /* var */_mode: string="自己";

        /* internal */ /* var */_bitmap: Object /* flash.display.Bitmap */;

        /* internal */ /* var */_leftFire: SWFPlayer;

        /* internal */ /* var */_rightFire: SWFPlayer;

        /* internal */ /* var */_bournSwf: SWFPlayer;

        protected /* var */_toolTipData;
    }
